Skip to content

Conversation

@codesungrape
Copy link
Collaborator

This pull request introduces a full CI pipeline (ci.yml). It ensures all future pull requests must satisfy testing, formatting, and static-analysis requirements before merging into main.

Key Changes

  • Added .github/workflows/ci.yml to run:
    • ./gradlew check
    • Unit tests
    • Checkstyle
    • SpotBugs
    • JaCoCo coverage verification (100% required)
  • Workflow prepares repository for GitHub branch protection rules.
  • Updated README to document project setup and quality tooling.

CI Enforcement (Post-Merge)

Once this PR is merged into main, the repository can be configured to block merges unless:

  • all CI checks pass,
  • test coverage stays at 100%,
  • and Checkstyle/SpotBugs report zero violations.
    This ensures consistent code quality across all future contributors.

- Refactor all Java files to comply with HMCTS checkstyle rules
- Expand wildcard imports and fix indentation/line-length violations
- Add .editorconfig using HMCTS formatting conventions
- Update .gitignore to include HMCTS-relevant patterns
- Remove Spotless plugin from build.gradle (not used in HMCTS projects)
- Ensure Checkstyle uses HMCTS-provided configuration files

This brings the project into alignment with the HMCTS engineering
standards and eliminates conflicting or redundant formatting tools.
Copilot AI review requested due to automatic review settings November 17, 2025 11:57
Copilot finished reviewing on behalf of codesungrape November 17, 2025 12:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request establishes a comprehensive CI/CD pipeline and code quality framework for the Book API project, ensuring consistent code standards and 100% test coverage for all future contributions.

Key Changes:

  • Introduced GitHub Actions CI workflow with automated testing, Checkstyle, SpotBugs, and JaCoCo coverage verification
  • Refactored package structure from BookAPI to bookapi (lowercase) to follow Java naming conventions
  • Converted BookRequest DTO from Lombok @Value to Java record type

Reviewed Changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.github/workflows/ci.yml New CI workflow that runs all quality checks on pull requests and pushes to main
build.gradle Added JaCoCo, Checkstyle, and SpotBugs plugins with 100% coverage enforcement and exclusions for DTOs/entities
config/checkstyle/checkstyle.xml Google Java Style-based Checkstyle configuration for code formatting enforcement
.editorconfig Editor configuration for consistent formatting (4-space indent for Java, LF line endings)
README.md Comprehensive documentation for running quality checks, coverage reports, and IDE setup
src/main/java/com/codesungrape/hmcts/bookapi/ Refactored main source files to lowercase package names with improved documentation
src/main/java/com/codesungrape/hmcts/bookapi/dto/BookRequest.java Converted from Lombok @Value to Java record type
src/main/java/com/codesungrape/hmcts/bookapi/repository/BookRepository.java Fixed method name from findByIdAndDeleteFalse to findByIdAndDeletedFalse
src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java Enhanced tests with better formatting and updated to use record accessor methods
src/test/java/com/codesungrape/hmcts/bookapi/BookApiApplicationTests.java Added @ActiveProfiles("test") for test-specific configuration
src/test/resources/application.properties New H2 in-memory database configuration for tests
.gitignore Added additional patterns for build artifacts and IDE files
Comments suppressed due to low confidence (6)

src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:132

  • The comment contains "CoPilot" which should be "Copilot" (one word, not camel case).
    src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:134
  • The annotation name is incorrectly written as "@notblank" (lowercase) when it should be "@notblank" (Pascal case) to match the actual Java annotation name.
    src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:133
  • The comment mentions "@value from Lombok" but BookRequest has been changed from a Lombok @Value class to a Java record. The comment should be updated to reflect that BookRequest is now a record type, not a Lombok @value class.
    src/main/java/com/codesungrape/hmcts/bookapi/service/BookService.java:33
  • The pronoun "i" should be capitalized to "I".
    src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:30
  • The Javadoc comment starts with /** followed by a period, which should be /** without the period. This is a documentation formatting issue.
    src/main/java/com/codesungrape/hmcts/bookapi/service/BookService.java:35
  • The annotation name is incorrectly written as "@notblank" (lowercase) when it should be "@notblank" (Pascal case) to match the actual Java annotation name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codesungrape codesungrape merged commit 0bcb2a0 into main Nov 17, 2025
1 check passed
@codesungrape codesungrape deleted the ci/setup-pipeline,-enforce-test-coverage-and-improve-tests branch November 17, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants